<?php

class Client_config_model extends MY_Model {

    function __construct() {
        parent::__construct();
        $this->table = 'm_client_config';
    }

    function loadBreadcrumb($id) {
        $this->db->select('id as client_id, name as client_name');
        $this->db->where('id', $id);
        $this->db->from($this->table);
        $query = $this->db->get();
        $result = $query->result();
        return count($result) > 0 ? $result[0] : NULL;
    }

    function getClientConfigBy($value, $column = 'id') {
        $this->db->select('m_client_config.id, m_client_config.storage_size, m_client.user_nm');
        $this->db->join('m_client', 'm_client.id = m_client_config.id');
        $this->db->where('m_client_config.' . $column, $value);
        $this->db->from($this->table);
        $query = $this->db->get();
        $result = $query->result();
        return count($result) > 0 ? $result[0] : NULL;
    }

}

?>
